import React, { Component } from 'react';
import './Myseckill.scss'
import { goods_list } from '../../utils/api'
class Myseckill extends Component {
    constructor(props) {
        super(props)
        this.state = {
            goodsList: []
        }
    }
    componentDidMount() {
        goods_list({count:9}).then((res) => {
            console.log(res);
            this.setState({
                goodsList: res.data.list
            })
        })
    }
    render() {
        return (
            <div className='seckill'>
                <div className='title'>
                    <span>今日值得买</span>
                    <div className='date'>
                        <span>00</span> : <span>40</span> : <span>10</span>
                    </div>
                    <span>后结束</span>
                </div>
                <div className='goodsList'>
                    
                    {
                        this.state.goodsList.map((item) => {
                           return (
                            <div className='item'>
                                <div className='imgBox'>
                                    <img src={item.pic} alt="" />
                                </div>
                                <p>{item.name}</p>
                                <span>原价 ￥{parseInt(item.salesPrice.value)}</span>
                                <div>抢购价 ￥<span>{parseInt(item.salesPrice.value)}</span></div>
                            </div>
                           )
                        })
                    }
                </div>

            </div>
        );
    }
}

export default Myseckill;